home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Demos / Tools / AppMaker / Examples / pre-built AMReminder / Procedural / Globals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-04  |  1.4 KB  |  80 lines  |  [TEXT/MMCC]

  1. /* Globals.c */
  2. /* Created 01/01/95 12:01 PM by AppMaker */
  3.  
  4. #include <Types.h>
  5. #include <Quickdraw.h>
  6. #include <Controls.h>
  7. #include <Dialogs.h>
  8. #include <Events.h>
  9. #include <Lists.h>
  10. #include <Menus.h>
  11. #include <TextEdit.h>
  12. #include "Globals.h"
  13.  
  14. /*Standard vars:*/
  15. Boolean            quittingTime;
  16. EventRecord        curEvent;
  17. WindowPtr        curWindow;
  18. WinInfoPtr        cur;
  19. Boolean            inBackground;
  20. SysConfigRec    sysConfig;
  21.  
  22. WinInfoRec        noCur;
  23.  
  24. /*----------*/
  25. void InitGlobals (void)
  26. {
  27.     curWindow = nil;
  28.     noCur.text = nil;
  29.     noCur.vScroll = nil;
  30.     noCur.hScroll = nil;
  31.     noCur.fileNum = 0;
  32.     noCur.volNum = 0;
  33.     noCur.dirty = false;
  34.     noCur.windowKind = noWindow;
  35.  
  36.     cur = &noCur;
  37. } /*InitGlobals*/
  38.  
  39. /*----------*/
  40. void SetInfo (WindowPtr        window)
  41. {
  42.     WinInfoPtr        infoPtr;
  43.  
  44.     if (window != curWindow) {
  45.         curWindow = window;
  46.         if (curWindow != nil) {
  47.             infoPtr = (WinInfoPtr) GetWRefCon (curWindow);
  48.             cur = infoPtr;
  49.         } else {
  50.             cur = &noCur;
  51.         }
  52.     }
  53. } /*SetInfo*/
  54.  
  55. /*----------*/
  56. void SetNewInfo (WindowPtr        window)
  57. {
  58.     WinInfoPtr        infoPtr;
  59.  
  60.     infoPtr = (WinInfoPtr) NewPtr (sizeof (WinInfoRec));
  61.     SetWRefCon (window, (long) infoPtr);
  62.     SetInfo (window);
  63. } /*SetNewInfo*/
  64.  
  65. /*----------*/
  66. void DiscardInfo (WindowPtr        window)
  67. {
  68.     WinInfoPtr        infoPtr;
  69.  
  70.     if (window == curWindow) {
  71.         SetInfo (nil);
  72.     }
  73.     infoPtr = (WinInfoPtr) GetWRefCon (window);
  74.     DisposPtr ((Ptr) infoPtr);
  75.     HideWindow (window);
  76.     DisposeWindow (window);
  77. } /*DiscardInfo*/
  78.  
  79. /* Globals */
  80.